
package com.jf.cloud.multishop.controller.app;

import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.multishop.model.ShopRenovation;
import com.jf.cloud.multishop.service.ShopRenovationService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.Operation;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 店铺装修信息
 * @author zz
 * @date 2022-08-12 11:27:18
 */
@RestController("appShopRenovationController")
@RequestMapping("/ua/shop_renovation")
@Tag(name = "app-店铺装修信息")
public class ShopRenovationController {

    @Autowired
    private ShopRenovationService shopRenovationService;

    @GetMapping("/get_home_page")
    @Operation(summary = "获取店铺主页装修信息" , description = "根据店铺id，装修类型获取店铺装修信息")
    @Parameters({
        @Parameter(name = "shopId", description = "店铺id" , required = true),
        @Parameter(name = "renovationType", description = "装修类型 1.pc 2.移动端" , required = true)
    })
    public ServerResponseEntity<ShopRenovation> getHomePage(@ParameterObject @RequestParam("shopId") Long shopId,
                                                            @ParameterObject @RequestParam("renovationType") Integer renovationType) {
        ShopRenovation shopHomeRenovation = shopRenovationService.getShopHomeRenovation(shopId, renovationType);
        return ServerResponseEntity.success(shopHomeRenovation);
    }

    @GetMapping("/get_renovation_by_id")
    @Operation(summary = "根据装修id获取店铺装修信息" , description = "根据装修id获取店铺装修信息")
    @Parameter(name = "renovationId", description = "装修id" , required = true)
    public ServerResponseEntity<ShopRenovation> getRenovationById(@ParameterObject @RequestParam("renovationId") Long renovationId) {
        ShopRenovation shopRenovation = shopRenovationService.getByRenovationId(renovationId);
        return ServerResponseEntity.success(shopRenovation);
    }
}
